#include <iostream>
using namespace std;
#include <vector>

void binsearch(vector<int> v , int num)
{
  int left = 0;
  int right = v.size() -1 ;
  int index = 0;
  while(left <= right)
  {
    int mid = left + ((right - left) / 2);
    if (v[mid] >= num)
    {
      index = mid;
      right = mid -1;
    }
    else 
    {
      left = mid + 1;
    }
  }

  cout << "find the index is:" << index << endl; 
}


int main()
{
  vector<int> v1 = {1 , 2 , 3, 3, 3, 4, 5, 5, 6, 7, 8, 9, 9, 9};
  binsearch(v1 , 3);
  return 0;
}
